using UnityEngine;

[ExecuteInEditMode]
public class RatioAdapter : MonoBehaviour
{
	public float preRatio;

	public float ratio;

	[SerializeField]
	private Camera m_Camera;

	[SerializeField]
	private Transform m_BallStorageRackTransRight;

	[SerializeField]
	private Transform m_BallStorageRackTransTop;

	[SerializeField]
	private Transform m_BallStorageRackTransBottom;

	[SerializeField]
	private BallStorageRack m_BallStorageRack;

	[SerializeField]
	private Vector4 m_BallStorageRackPositionRight = new Vector4(5.725f, -3.271f, -0.354f, 185.7989f);

	[SerializeField]
	private Vector4 m_BallStorageRackPositionTop = new Vector4(-2.202f, -3.27f, 3.202f, 95.53929f);

	private void Adapting()
	{
		if (ratio <= 1.45f)
		{
			m_Camera.transform.localPosition = new Vector3(3.57f, 8.33f, 3.32f);
			m_Camera.orthographicSize = 4.5f;
			m_BallStorageRack.transform.localPosition = new Vector3(m_BallStorageRackPositionTop.x, m_BallStorageRackPositionTop.y, m_BallStorageRackPositionTop.z);
			Transform transform = m_BallStorageRack.transform;
			Vector3 localEulerAngles = m_BallStorageRack.transform.localEulerAngles;
			float x = localEulerAngles.x;
			float w = m_BallStorageRackPositionTop.w;
			Vector3 localEulerAngles2 = m_BallStorageRack.transform.localEulerAngles;
			transform.localEulerAngles = new Vector3(x, w, localEulerAngles2.z);
		}
		else if (ratio <= 1.55f)
		{
			m_Camera.transform.localPosition = new Vector3(3.23f, 8.33f, 3.49f);
			m_Camera.orthographicSize = 4.15f;
			m_BallStorageRack.transform.localPosition = new Vector3(m_BallStorageRackPositionTop.x, m_BallStorageRackPositionTop.y, m_BallStorageRackPositionTop.z);
			Transform transform2 = m_BallStorageRack.transform;
			Vector3 localEulerAngles3 = m_BallStorageRack.transform.localEulerAngles;
			float x2 = localEulerAngles3.x;
			float w2 = m_BallStorageRackPositionTop.w;
			Vector3 localEulerAngles4 = m_BallStorageRack.transform.localEulerAngles;
			transform2.localEulerAngles = new Vector3(x2, w2, localEulerAngles4.z);
		}
		else if (ratio <= 1.65f)
		{
			m_Camera.transform.localPosition = new Vector3(3.53f, 8.33f, 3.19f);
			m_Camera.orthographicSize = 4.1f;
			m_BallStorageRack.transform.localPosition = new Vector3(m_BallStorageRackPositionRight.x, m_BallStorageRackPositionRight.y, m_BallStorageRackPositionRight.z);
			Transform transform3 = m_BallStorageRack.transform;
			Vector3 localEulerAngles5 = m_BallStorageRack.transform.localEulerAngles;
			float x3 = localEulerAngles5.x;
			float w3 = m_BallStorageRackPositionRight.w;
			Vector3 localEulerAngles6 = m_BallStorageRack.transform.localEulerAngles;
			transform3.localEulerAngles = new Vector3(x3, w3, localEulerAngles6.z);
		}
		else if (ratio <= 1.7f)
		{
			m_Camera.transform.localPosition = new Vector3(3.52f, 8.33f, 3.13f);
			m_Camera.orthographicSize = 3.92f;
			m_BallStorageRack.transform.localPosition = new Vector3(m_BallStorageRackPositionRight.x, m_BallStorageRackPositionRight.y, m_BallStorageRackPositionRight.z);
			Transform transform4 = m_BallStorageRack.transform;
			Vector3 localEulerAngles7 = m_BallStorageRack.transform.localEulerAngles;
			float x4 = localEulerAngles7.x;
			float w4 = m_BallStorageRackPositionRight.w;
			Vector3 localEulerAngles8 = m_BallStorageRack.transform.localEulerAngles;
			transform4.localEulerAngles = new Vector3(x4, w4, localEulerAngles8.z);
		}
		else
		{
			m_Camera.transform.localPosition = new Vector3(3.54f, 8.33f, 3.11f);
			m_Camera.orthographicSize = 3.84f;
			m_BallStorageRack.transform.localPosition = new Vector3(m_BallStorageRackPositionRight.x, m_BallStorageRackPositionRight.y, m_BallStorageRackPositionRight.z);
			Transform transform5 = m_BallStorageRack.transform;
			Vector3 localEulerAngles9 = m_BallStorageRack.transform.localEulerAngles;
			float x5 = localEulerAngles9.x;
			float w5 = m_BallStorageRackPositionRight.w;
			Vector3 localEulerAngles10 = m_BallStorageRack.transform.localEulerAngles;
			transform5.localEulerAngles = new Vector3(x5, w5, localEulerAngles10.z);
		}
	}

	private void Awake()
	{
		m_BallStorageRack = UnityEngine.Object.FindObjectOfType<BallStorageRack>();
		m_Camera = GetComponent<Camera>();
		ratio = (float)Screen.width / (float)Screen.height;
		preRatio = ratio;
		Adapting();
	}
}
